Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-utf8

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-utf8

Detect if a buffer is utf8 encoded.

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.6M
decreased by-8.29%
Maintainers
1
Weekly downloads
 
Created

What is is-utf8?

The is-utf8 npm package is a simple utility that allows you to check if a given buffer is valid UTF-8 encoded text. It is useful when you need to validate the encoding of text data in Node.js applications.

What are is-utf8's main functionalities?

Check if a buffer is UTF-8

This feature allows you to check if a buffer contains valid UTF-8 encoded text. The code sample demonstrates reading a file into a buffer and then using is-utf8 to check if the buffer is UTF-8.

const isUtf8 = require('is-utf8');
const fs = require('fs');

const buffer = fs.readFileSync('somefile.txt');
const isValidUtf8 = isUtf8(buffer);
console.log(isValidUtf8); // outputs true or false

Other packages similar to is-utf8

Keywords

FAQs

Package last updated on 19 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc